﻿using ReflectionStudio.Core;
using ReflectionStudio.Core.Events;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.OracleClient;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Xml;
namespace WPFExcelReport
{
    public partial class JLTAB55DOCReport : BaseReport
    {

        private void FillInAB55WB()
        {
            string value = "";
            DataRow dwABPOS = null;
            int rStart = 0;
            int nRow = 1;
            int nPRow = 1;
            int idx = 0;
            int pages = 0;
            dwABPOS = dsSource.Tables["ABPOS"].Rows[0];

            DataRow dwABK = dsSource.Tables["ABKOPF"].Rows[0];
            DataRow dwWS = null;
            if (dsSource.Tables["WASTAMM"].Rows.Count > 0)
            {
                dwWS = dsSource.Tables["WASTAMM"].Rows[0];
            }

            #region====yarn=========
            rStart = 1;
            nRow = 5;
            idx = 0;
            int ycount = dsSource.Tables["WBBST"].Rows.Count;
            foreach (DataRow rw in dsSource.Tables["WBBST"].Rows)
            {
                exAgent.SetCellValue(rStart + idx * nRow, 1, "布卷号");
                exAgent.SetCellValue(rStart + idx * nRow, 12, "落布日期");
                exAgent.SetCellValue(rStart + idx * nRow + 1, 12, "生产单号");
                exAgent.SetCellValue(rStart + idx * nRow + 2, 12, "织机");
                exAgent.SetCellValue(rStart + idx * nRow + 3, 12, "小花号");
                exAgent.SetCellValue(rStart + idx * nRow + 1, 16, rw["WBBAUFKRS"].ToString().Trim() + "-" + Helpers.Helper.GetSubRollNum(rw["WBBAUFLFD"].ToString().Trim())
                     + "-" + Helpers.Helper.GetSubRollNum(rw["WBBAUFPOS"].ToString().Trim()));
                exAgent.SetCellValue(rStart + idx * nRow + 3, 16, rw["WBBART"].ToString().Trim() + "-" + rw["WBBFARBE"].ToString().Trim());
                exAgent.SetCellValue(rStart + idx * nRow + 1, 1, "*" + rw["WBBSTKNR"].ToString().Trim() + "*");
                //exAgent.SetCellValue(rStart + idx * nRow , 4,  rw["WBBSTKNR"].ToString().Trim());
                idx++;
                if (idx < ycount)
                {
                    exAgent.RangeCopy(1, 5, rStart + idx * nRow, rStart + idx * nRow + 5);
                }


            }

            #endregion

        }
    }
}